package com.itheima.DEMO;

import com.itheima.domain.Student;

import java.util.ArrayList;
import java.util.Scanner;

public class demo03 {
    public static void main(String[] args) {
        ArrayList<Student> list = new ArrayList<Student>();
        Student stu1 = getStudent(1);
        Student stu2 = getStudent(2);
        Student stu3 = getStudent(3);
        list.add(stu1);
        list.add(stu2);
        list.add(stu3);
        for (int i = 0; i < list.size(); i++) {
            Student stu = list.get(i);
            System.out.println(stu.getName()+".."+stu.getAge());
        }
    }
    public static Student getStudent(int count){
        Scanner sc = new Scanner(System.in);
        System.out.println(count);
        String name = sc.next();
        System.out.println(count);
        int age =sc.nextInt();
        Student stu = new Student(name ,age);
        return stu;
    }

}
